package com.yitongmao.common.sharesdk;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;


public class Account implements Serializable {

    /**
     * success : true
     * uid : 36
     * nickName : 186****1634
     * mobile : 18600261634
     */
    private String sid;
    private int sex;
    private int uType;
    private boolean success;
    private String msg;
    private int uid;
    private String nickName;
    private String mobile;
    private String faceUrl;
    private String address;
    private int scores;
    private boolean firstRegister;

    private boolean isThirdPartyLogin;

    private String perm;

    private String expireDate;

     public static Account objectFromData(String str) {

        return new Gson().fromJson(str, Account.class);
    }
    public static Account objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), Account.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<Account> arrayAccountFromData(String str) {

        Type listType = new TypeToken<ArrayList<Account>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }
    public static List<Account> arrayAccountFromData(String str, String key) {
        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<Account>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }
//    private int uType;

    public void setSid(String sid) {
        this.sid = sid;
    }

    public String getSid() {
        return sid;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public int getSex() {
        return sex;
    }

    public void setuType(int uType) {
        this.uType = uType;
    }

    public int getuType() {
        return uType;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getUid() {
        return uid;
    }

    public void setUid(int uid) {
        this.uid = uid;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getFaceUrl() {
        return faceUrl;
    }

    public void setFaceUrl(String faceUrl) {
        this.faceUrl = faceUrl;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getScores() {
        return scores;
    }

    public void setScores(int scores) {
        this.scores = scores;
    }

    public boolean isIsThirdPartyLogin() {
        return isThirdPartyLogin;
    }

    public void setIsThirdPartyLogin(boolean isThirdPartyLogin) {
        this.isThirdPartyLogin = isThirdPartyLogin;
    }

    public boolean isFirstRegister() {
        return success;
    }

    public void setFirstRegister(boolean firstRegister) {
        this.firstRegister = firstRegister;
    }

    public void setPerm(String perm) {
        this.perm = perm;
    }

    public String getPerm() {
        return perm;
    }

    public String getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(String expireDate) {
        this.expireDate = expireDate;
    }
}
